<template>
  <div class="volunteer-table">
    <div class="volunteer-table-item" v-for="(item, idx) in props.list" :key="item.label">
      <div class="item label">第{{ idx + 1 }}志愿</div>
      <div class="item addr">{{ item.area }}</div>
      <div class="item subject"> {{ item.subject }}</div>
      <div class="item grade">{{ item.grade }}</div>
    </div>
    <div class="volunteer-table-item">
      <div class="item label"> 服从调剂</div>
      <div class="item addr">
        <img :src="adJustMap.areaIsAdjust?accept:reject" alt="" srcset="">地区
      </div>
      <div class="item subject">
        <img :src="adJustMap.subjectIsAdjust?accept:reject" alt="" srcset="">科目
      </div>
      <div class="item grade">
          <img :src="adJustMap.gradeIsAdjust?accept:reject" alt="" srcset="">年级
        </div>
    </div>
    <div class="operator">
      <div class="operator-item">
        提交人：{{ store.currentResume.submitUserName }}
      </div>
      <div class="operator-item">
        提交时间：{{ store.currentResume.volunteerSubmitTime }}
      </div>
    </div>
  </div>
</template>

<script setup lang='ts'>
import { ref, watch } from "vue"
const props = defineProps(['list', "operatorInfo",]);
import { getImageUrl } from "@/assets/common/common.ts";
import { comStores } from '@/store/common/comStore';
const accept =getImageUrl('accept.png','applicationDetail')
const reject =getImageUrl('reject.png','applicationDetail')
const store = comStores()
const adJustMap = ref({
  subjectIsAdjust: true,
  gradeIsAdjust: true,
  areaIsAdjust: true
})
watch(() => props.list, (val) => {
  if (val.length > 0) {
    // 0接受 1不接受
    let cur = val[0]
    adJustMap.value.subjectIsAdjust = cur.subjectIsAdjust === 0
    adJustMap.value.gradeIsAdjust = cur.gradeIsAdjust === 0
    adJustMap.value.areaIsAdjust = cur.areaIsAdjust === 0
  }
}, { deep: true })

</script>

<style lang="less" scoped>
.volunteer-table {
  display: flex;
  width: 100%;
  flex-direction: column;
  margin-bottom: 40px;

  .volunteer-table-item {
    width: 100%;
    flex: 1;
    height: 44px;
    background: #F5F7FB;
    border-radius: 0px 3px 0px 0px;
    // border-bottom: 1px solid rgba(179, 192, 200, 0.3);
    display: flex;
    line-height: 44px;

    .item {
      flex: 1;
      text-align: center;
      pointer-events: none;
      cursor: default;
      img{
        width: 14px;
        margin-right: 5px;
      }
    }

    .label {
      height: 44px;
      background: #209EE4;
      color: #fff;
      flex:0.6;
    }

    &:nth-child(2) {
      .label {
        background: #38B5FA
      }
    }

    &:nth-child(3) {
      .label {
        background: #6DCBFF;
      }
    }
    &:nth-child(4) {
      .label {
        background: rgb(136,212,255);
      }
    }
    &:nth-child(5) {
      .label {
        background: rgb(157,219,255)
      }
    }
  }
}

.operator {
  margin-top: 11px;
  display: flex;
  justify-content: space-between;
  padding: 0 30px;
  box-sizing: border-box;
  font-size: 14px;
  color: #333;
  font-weight: 400;
}
</style>